OpenGL 4.0 Shading Language Cookbook by Wolff David

OpenGL 4.0 Shading Language Cookbook by Wolff David

Author:Wolff, David
Language: eng
Format: epub
Publisher: Packt Publishing


Where the one-dimensional Gaussian function is given by the following equation:

So if Cij is the color of the pixel at pixel location (i,j), the sum that we need to compute is given by the following equation:

This can be re-written using the fact that the two-dimensional Gaussian is a product of two one-dimensional Gaussians.

This implies that we can compute the Gaussian blur in two passes. In the first pass, we can compute the sum over j (the vertical sum) in the preceding equation and store the results in a temporary texture. In the second pass, we compute the sum over i (the horizontal sum) using the results from the previous pass.

Now, before we look at the code, there is one important point that has to be addressed. As we mentioned previously, the Gaussian weights must sum to one in order to be a true weighted average. Therefore, we need to normalize our Gaussian weights as in the following equation:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.